package com.wm.task1.util;

import com.wm.task1.vo.Massage;

import java.sql.*;
import java.util.ArrayList;
import java.util.List;


public class LinkDB {
    /*try {
            //找到一个驱动
            Driver driver = new com.mysql.cj.jdbc.Driver();
            DriverManager.registerDriver(driver);
            //获取到数据库的链接
            String url = "jdbc:mysql://127.0.0.1:3306/demosys";
            String user = "root";
            String pass = "wanmait";
            java.sql.Connection connection = DriverManager.getConnection(url,user,pass);
            //获取一个语句载体
            PreparedStatement ps = connection.prepareStatement("SELECT * FROM student");
            //执行查询获取返回结果
            ResultSet rs = ps.executeQuery();
            while(rs.next()){
                //有下一行 ，并且当前指向了所在行
                int id = rs.getInt("id");
                String name = rs.getString("name");
                String phone = rs.getString("phone");
                System.out.printf("%d,%s,%s\n",id,name,phone);
            }
            rs.close();
            ps.close();
            connection.close();

            //System.out.println(connection);
        } catch (SQLException e) {
            e.printStackTrace();
        }*/

}
